package com.ruoyi.accounting.service.impl;

import com.ruoyi.accounting.domain.AccAccountingRecord;
import com.ruoyi.accounting.domain.dto.AccAccountingRecordImport;
import com.ruoyi.accounting.enums.AccountingRecordTypeEnum;
import com.ruoyi.accounting.service.AccountingRecordStrategy;
import com.ruoyi.common.core.exception.ServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * 收入类型流水处理策略
 */
@Component
@Slf4j
public class IncomeAccountingRecordStrategy implements AccountingRecordStrategy {
    @Override
    public void validate(AccAccountingRecord request) {
        if (request.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
            throw new ServiceException("收入金额必须大于0");
        }
    }

    @Override
    public void process(AccAccountingRecord request) {

    }

    @Override
    public Integer getType() {
        return AccountingRecordTypeEnum.INCOME.getCode();
    }

    @Override
    public List<AccAccountingRecord> importFromExcel(List<AccAccountingRecordImport> importList, Long bookId) {
        return null;
    }
}
